package com.String;

import java.util.Scanner;

/*
根据身份证来截取出生日期
*/
public class Demo03 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请输入身份号来获取你的生日信息：");
            String id = sc.next();
            if (id.length() == 18) {
                String year = id.substring(6, 10);
                String month = id.substring(10, 12);
                String day = id.substring(12, 14);
                System.out.println("你的生日为：" + year + "年" + month + "月" + day + "日");
                break;
            } else {
                System.out.println("你输入的信息有误，请重新输入：");
            }
        }

    }
}
